﻿@model BootyBay.Models.View_Application

@{
    ViewBag.Title = "ApplicationInfo";
    Layout = "~/Views/Shared/_Layout.cshtml";
    List<SelectListItem> categoryList = (ViewBag.CategoryList as List<BootyBay.Models.Category>)
        .Select(c => new SelectListItem() { Text = c.Value, Value = c.Id.ToString() })
        .ToList();
    List<String> keywords = new List<string>();
    if (!string.IsNullOrEmpty(Model.Keywords))
    {
        keywords = Model.Keywords.Split(';').ToList();
    }
}

<h2>Public Store Application Info</h2>
<h2>@(Model.ApplicationName)</h2>

@using (Html.BeginForm("ApplicationPublicInfo", "Package", new { Id = Model.Id, Id_ApplicationVersion = Model.Id_ApplicationVersion }))
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        @Html.ValidationSummary(true)

        <h3>App name</h3>
        <div>
            <span>App alias *</span>
            <p>This name is used to refer to your app here on Dev Center. The name your customer sees is read directly from your package.</p>
            @Html.EditorFor(model => model.ApplicationName)
        </div>

        <h3>Public Store Url</h3>
        <div>
            <p>Public Store URL is required for application in Public Store.</p>
            @Html.EditorFor(model => model.StoreHttpUrl)
        </div>

        <h3>Description</h3>
        <div>
            @Html.TextAreaFor(model => model.Description, new { rows = 5, cols = 100 })
        </div>

        <h3>Keywords</h3>
        <div>
            @for (int i = 0; i < 10; i++)
            {
                if (i >= keywords.Count)
                {
                    <input type="text" name="keyword" value="" />
                }
                else
                {
                    <input type="text" name="keyword" value="@keywords[i]" />
                }
            }
        </div>

        <h3>App category</h3>
        <p>The Category and Subcategory determine where the app will be listed in the Store.</p>
        <div>
            <span>Category</span>
            @Html.DropDownListFor(model => model.Category, categoryList)
            <div style="display:none">
                <span>Subcategory</span>
                @Html.DropDownListFor(model => model.Subcategory, new List<SelectListItem>() { new SelectListItem() { Text = "1", Value = "1" } })
            </div>
        </div>

        <h3>Application Status</h3>
        <label><input type="checkbox" name="IsRecommended">Recommend this application</label><br />
        <label><input type="checkbox" name="IsHidden">Is hidden from store?</label>
        <br />
        <div>
            <input type="submit" value="Save" />
        </div>
    </div>
}